﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Quarto
{
    public class Sprite
    {
        private Texture2D texture;
        public Rectangle Dimentions;
        public Texture2D Texture
        {
            get { return texture; }
            set { texture = value; }
        }

        public Sprite()
        {

        }
        public Sprite(Texture2D t, int x, int y)
        {
            this.texture = t;
            this.Dimentions = new Rectangle(x, y, t.Width, t.Height);
        }
        public bool test_clic(Vector2 position_clic)
        {
            Point souris = new Point((int)position_clic.X, (int)position_clic.Y);
            if (this.Dimentions.Contains(souris))
            {
                return true;
            }
            return false;
        }
        public void Draw(SpriteBatch spriteBatch, int taille)
        {
            float echelle = (float)taille/(float)this.texture.Width;
            Vector2 position = new Vector2(this.Dimentions.X, this.Dimentions.Y);
            Vector2 origine = new Vector2(0, 0);
            spriteBatch.Draw(this.Texture, position, null, Color.White, 0f, origine, echelle, SpriteEffects.None, 0f);
        }
    }
}
